import { legacy_createStore, combineReducers, compose, applyMiddleware } from "redux";
import { thunk } from 'redux-thunk'
import Page1Reducer from '@/store/Page1/reducer'

// 合并所有模块的reducer
const reducers  = combineReducers({
    // 定义模块的名字
    page1Store: Page1Reducer
})

// 为了让浏览器正常使用redux-devtools-extension redux-thunk
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ?  window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}) : compose;

// 创建仓库
const store = legacy_createStore(
    reducers, 
    composeEnhancers(applyMiddleware(thunk))
)

export default store